#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<bitset>
#include<vector>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define rep(i,a,b) for(register int i = (a);i <= (b);++i)
#define per(i,a,b) for(register int i = (a);i >= (b);--i)  
typedef long long ll;
typedef unsigned long long ull;
using std::string;using std::cin;using std::cout;

const int N = 5e3+5;
const ll inf = 1e12+9;
int n,s,l,r;
ll t[N],f[N],sum_t[N],sum_f[N],dp[N],q[N];

int main(){
/*  # 斜率优化推导
    dp[i] = dp[j-1] + sum_t[i] * (sum_f[i] - sum_f[j-1]) + s * (sum_f[n] - sum_f[j-1]))
    dp[i] = dp[j-1] + sum_t[i] * sum_f[i] - sum_t[i] * sum_f[j-1] + s * sum_f[n] - s * sum_f[j-1]
    dp[i] = dp[j-1] - sum_f[j-1] * (sum_t[i] + s) + (sum_t[i] * sum_f[i] + s * sum_f[n])
    dp[i] = y       - x          * k              + b
    dp[i] = y - k*x + b
    y = k*x + dp[i] - b
*/
    std::ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("in.in", "r", stdin);
    cin >> n >> s;
    rep(i,1,n) cin >> t[i] >> f[i];
    rep(i,1,n) sum_t[i] = sum_t[i-1] + t[i] , sum_f[i] = sum_f[i-1] + f[i];
    rep(i,1,n) dp[i] = inf;
    l = r = 1;
    rep(i,1,n){
        while(l<r && (dp[q[l+1]] - dp[q[l]]) <= (sum_f[q[l+1]] - sum_f[q[l]])*(sum_t[i] + s)) ++l;
        dp[i] = dp[q[l]] - (sum_t[i]+s)*sum_f[q[l]] + sum_t[i]*sum_f[i] + s*sum_f[n];
        while(l<r && ((sum_f[q[r]] - sum_f[q[r-1]])*(dp[i] - dp[q[r]]) <= (sum_f[i] - sum_f[q[r]])*(dp[q[r]] - dp[q[r-1]]))) --r; 
        q[++r] = i;
    }
    cout << dp[n] << "\n";
}

/*
O(N^2)解法

int main(){
    std::ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("in.in", "r", stdin);
    cin >> n >> s;
    rep(i,1,n) cin >> t[i] >> f[i];
    rep(i,1,n) sum_t[i] = sum_t[i-1] + t[i] , sum_f[i] = sum_f[i-1] + f[i];
    rep(i,1,n) dp[i] = inf;
    rep(i,1,n) rep(j,1,i)
        dp[i] = std::min(dp[i],dp[j-1] + sum_t[i] * (sum_f[i] - sum_f[j-1]) + s * (sum_f[n] - sum_f[j-1]));
    cout << dp[n] << "\n";
    return 0;
}
*/